
package util;

import javax.persistence.EntityManager;
import javax.persistence.Persistence;


public class ConnectionFactory {
    private EntityManager em;
    private static ConnectionFactory instance;

    public ConnectionFactory() {
    }
     public static ConnectionFactory getInstance(){
        if(instance == null){
            instance = new ConnectionFactory();
        }
        return instance;
    }
    
    public EntityManager getEntityMananger(){
        if(em == null){
            em = Persistence.createEntityManagerFactory("ClinicaMedicaJSFPU").createEntityManager();
        }
        return em;
    }
    
}
